<%@ page import="com.atguigu.scw.manager.constant.Constans" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fun" uri="http://java.sun.com/jsp/jstl/functions" %>
<div class="col-sm-3 col-md-2 sidebar">
    <div class="tree">
        <ul style="padding-left:0px;" class="list-group">
            <li class="list-group-item tree-closed">
                <a href="${ctp}/main.html"><i class="glyphicon glyphicon-dashboard"></i> 控制面板</a>
            </li>
            <c:forEach items="<%=session.getAttribute(Constans.MAIN_MENU)%>" var="parentMenu">
                <%-- 遍历父菜单--%>
                <li class="list-group-item tree-closed">
                    <span>
                        <i class="${parentMenu.icon}"></i>${parentMenu.name}
                        <span class="badge" style="float:right">
                            <%-- 方法1--%>
<%--                            ${parentMenu.children.size()}--%>
                            <%-- 方法2--%>
                            ${fun:length(parentMenu.children)}
                        </span>
                    </span>
                    <ul style="margin-top:10px;display:none;">
                        <c:forEach items="${parentMenu.children}" var="childrenMenu">
                            <%-- 遍历子菜单--%>
                            <li style="height:30px;">
                                <a href="${ctp}/${childrenMenu.url}">
                                    <i class="${childrenMenu.icon}"></i>${childrenMenu.name}
                                </a>
                            </li>
                        </c:forEach>
                    </ul>
                </li>
            </c:forEach>
        </ul>
    </div>
</div>